<?php
/**
删除远程所有包含 dengpan/ 相关的分之的
使用的时候
git remote show origin | grep dengpan  | php deleteRemoteBranch.php
*/
while($f = fgets(STDIN)) {
	$line = trim($f);
	if(strlen($line) > 0) {
		$pos = mb_strpos($line, "dengpan/");
		if($pos !== false) {
			$line = mb_substr($line, $pos);
			//echo $line, "\n";
			$pos_Blank = mb_strpos($line, " ");
			$branchName = mb_substr($line, 0, $pos_Blank);
			

			echo $branchName, "\n";
			echo shell_exec("git push --delete origin $branchName");		
			echo "\n";
		}
	}	
}
